package com.boang.buffer;

/*
    @author:sa
    @date:2024/11/21 16:04
*/
public class StringBufferDemo {
    public static void main(String[] args) {
        StringBuffer stringBuffer = new StringBuffer();
        m1(stringBuffer);
        m2(stringBuffer);
        m3(stringBuffer);
        System.out.println(stringBuffer.indexOf("a"));
        System.out.println(stringBuffer);
    }

    private static void m3(StringBuffer stringBuffer) {
        stringBuffer.setCharAt(1,'w');
    }

    private static void m2(StringBuffer stringBuffer) {
        stringBuffer.delete(1,3);
    }

    private static void m1(StringBuffer stringBuffer) {
        stringBuffer.append("a");
        stringBuffer.append("b");
    }
}